UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pisrtNcd0ZsGc8NddMy3KCLeZdJ1KRfLoIIL5fArrns=' 
WHERE 
  key_id = '927f7b5b31f0565a080f44dc2285479bc86aec1e7e8a97cd546475e798825f6e' 
  AND (
    token = 'pisrtNcd0ZsGc8NddMy3KCLeZdJ1KRfLoIIL5fArrns=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036