UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CLJ7fkuE4g3+Y+AQEPisEGg36F5RCDmUB/gu/+vgR+s=' 
WHERE 
  key_id = 'dac86849c974eabd4740947c8ef04b8618702343d05d13c4e708f8b99634b1a6' 
  AND (
    token = 'CLJ7fkuE4g3+Y+AQEPisEGg36F5RCDmUB/gu/+vgR+s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033