UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RaOWknrfy/2fVgB2k42PVdA2IWq1rS71kMRnA/zRc/Q=' 
WHERE 
  key_id = 'b8d7582625a3e0ac0934764bee724024e954717cdb9905067caef47cb4e0b5b6' 
  AND (
    token = 'RaOWknrfy/2fVgB2k42PVdA2IWq1rS71kMRnA/zRc/Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044