UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1cFLMOJUtk8j1qTOS6f+s+Nx6lGXvy9YMAWDc/Bpovk=' 
WHERE 
  key_id = 'aee97cba1243ba153a87638de01a8f9a64ebb51583289509b045f9da7d79f491' 
  AND (
    token = '1cFLMOJUtk8j1qTOS6f+s+Nx6lGXvy9YMAWDc/Bpovk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034