UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5edAj7xERxI5FN0bpKW2/nRqyQ93p2OcuRVEEdZa2tk=' 
WHERE 
  key_id = 'd76d31f8934c824352769cf26479395492cc7059817b294028f3d9e533fcc812' 
  AND (
    token = '5edAj7xERxI5FN0bpKW2/nRqyQ93p2OcuRVEEdZa2tk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039