UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y2y2W35f6+KdbUPsn52M+2Y8tVYEL0KEYwf8meEpuPw=' 
WHERE 
  key_id = '62fa2246edd465516613c346853cf3e3af23d2c5b5aac60d332ecc61b9cc2c8e' 
  AND (
    token = 'Y2y2W35f6+KdbUPsn52M+2Y8tVYEL0KEYwf8meEpuPw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032