UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O8ITgY4okGdtMethgMsxuX+T6NOilT9hs0GyEmEjdGc=' 
WHERE 
  key_id = 'f072d013712b9ddd0e017b8fae3c2a7e51b796f3324f0f2d7df1f5fda74521b5' 
  AND (
    token = 'O8ITgY4okGdtMethgMsxuX+T6NOilT9hs0GyEmEjdGc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028