UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K36e/iawMFd8jo56hZfGrk4huy0xMTlzdQaIOjCjejk=' 
WHERE 
  key_id = 'af3f4c463acfc967377a144940b5b5f179012bd21d316e79e2ce9dcd8b003a40' 
  AND (
    token = 'K36e/iawMFd8jo56hZfGrk4huy0xMTlzdQaIOjCjejk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027