UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G43cD2r7Yp2+jmOodC8EuzhpzlH7MbeWFeEji3J+smc=' 
WHERE 
  key_id = 'aae78cd21a4fec81bce54fc9c504c7e2d0649d956b5bae1ba2f57cd4222c41a7' 
  AND (
    token = 'G43cD2r7Yp2+jmOodC8EuzhpzlH7MbeWFeEji3J+smc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046