UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LOwxw4S+B9oRNmlraitpD4BahwMPfBIKPKNo3jvnDCo=' 
WHERE 
  key_id = 'be2982e6a53665af4bdfc1330f0a485ca44aa7fbfa5809a5a756cf8f06717869' 
  AND (
    token = 'LOwxw4S+B9oRNmlraitpD4BahwMPfBIKPKNo3jvnDCo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017