UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TElqag4q0FXZNJ+KX670pWUkp/7in2s3COG1WikZjfI=' 
WHERE 
  key_id = 'b321b31f6fe807a7571dc2db8bd0b86cbc8883454609f62e19ecc55b20aa854b' 
  AND (
    token = 'TElqag4q0FXZNJ+KX670pWUkp/7in2s3COG1WikZjfI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020