UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g3+XUjGhxTDW8sKap5mnQpYUaDhSCabIP7j25Qji0sM=' 
WHERE 
  key_id = '8eee4e9cd68fbdde9ec41b5a9373e2cf3818ea6584c2841811ba3a91adaa124b' 
  AND (
    token = 'g3+XUjGhxTDW8sKap5mnQpYUaDhSCabIP7j25Qji0sM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027