UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ji0HUcaDe5f6jcb9ulqQAx7QKPw1DshTpV3Qgg1zcKk=' 
WHERE 
  key_id = 'c5414267898f2528a0daa8837442a46bae928f0e0902536e03a5aa6e1215878e' 
  AND (
    token = 'Ji0HUcaDe5f6jcb9ulqQAx7QKPw1DshTpV3Qgg1zcKk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047