UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0S3p0Gy3eCWE7qlKYXtSp4T3rtzBBtAzxxR4shmpSxY=' 
WHERE 
  key_id = '8d4bc771fb3fd4c9cfcfc1a3a05d903a927855cb71d8ce47e1c30c77f4bbd02e' 
  AND (
    token = '0S3p0Gy3eCWE7qlKYXtSp4T3rtzBBtAzxxR4shmpSxY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031