UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '60upP23CihxutztAhZ0H3AEgx/9+6oAtalvuPQn8psg=' 
WHERE 
  key_id = 'fe50f7e9c3b802c085b07e2985c2bafbb2150dfbb7ea25b753478176d23da5c2' 
  AND (
    token = '60upP23CihxutztAhZ0H3AEgx/9+6oAtalvuPQn8psg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052