UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6xf5Cr1q33kzKLP+CPEWKLRCN/PLj21a5+Lner3nnC8=' 
WHERE 
  key_id = '2a07628436936d844427b150e7d0e55b2773075fe5e6ce9a1d732e1caf5caf93' 
  AND (
    token = '6xf5Cr1q33kzKLP+CPEWKLRCN/PLj21a5+Lner3nnC8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032