UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sYMjRTonfO8yrBxJOgnSJZcqQy4e7h/QEwRy7fMjfOM=' 
WHERE 
  key_id = 'e78a8a36ce06351b32060176f77bd6b5441f97c239974de138864daf0504e8d5' 
  AND (
    token = 'sYMjRTonfO8yrBxJOgnSJZcqQy4e7h/QEwRy7fMjfOM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036