UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TT3QF86y1o6PKdlDHoFOeVsXE8JlQdB8uJ8bi9v/1Hk=' 
WHERE 
  key_id = 'e7048a41cb45b59f5df4e195847e588cf7b32029337c1137f358d54249feebfc' 
  AND (
    token = 'TT3QF86y1o6PKdlDHoFOeVsXE8JlQdB8uJ8bi9v/1Hk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032