UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7nASZP9uZtaWhIwEszVqaKkiBGne9bT77hNAswZyct4=' 
WHERE 
  key_id = 'c3d59cbea69bd1f18fd5f81a7b4e975f3979cfbef2cd9b39eec19947e632e293' 
  AND (
    token = '7nASZP9uZtaWhIwEszVqaKkiBGne9bT77hNAswZyct4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018