UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iOpHLg5gkKDFGISS5nlRW0Zo9fQ+crz0BeAivaUuouA=' 
WHERE 
  key_id = '9654ed13f542e7795bb88fff9cf21b7366e26371081697bd3fc23e385b93dd14' 
  AND (
    token = 'iOpHLg5gkKDFGISS5nlRW0Zo9fQ+crz0BeAivaUuouA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024