UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'krEgjHhHzM4fxXb5t4ebVDx2uW+0LDuX4nnPjI4X/1I=' 
WHERE 
  key_id = 'a41f617eaa6df238f167cccfcac68f83910aa4f6bdf591278ef80723f3605ee3' 
  AND (
    token = 'krEgjHhHzM4fxXb5t4ebVDx2uW+0LDuX4nnPjI4X/1I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045