UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Wbwsqh0S78swFt+1CSvM0AW3GTT+8cwplG6rduf313Y=' 
WHERE 
  key_id = 'cbb90e2d6a5abd13874da324f2a9484abb9d73a89c91fe1848e7094bc1766f45' 
  AND (
    token = 'Wbwsqh0S78swFt+1CSvM0AW3GTT+8cwplG6rduf313Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026