UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uGMm0uMjkzgrV/tuNBFtKcCGs9qA0zVAlCNc6c/PqCE=' 
WHERE 
  key_id = 'ad227ec54aee120e6f6df2c4b1b2dea6417057a02895459524877a3026819be4' 
  AND (
    token = 'uGMm0uMjkzgrV/tuNBFtKcCGs9qA0zVAlCNc6c/PqCE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025