UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KzUTCYEMc6jelU50tZ/RPckqegUaELOsU7scwYpQF8s=' 
WHERE 
  key_id = '4ac30334c0904cc480bb29b8be2e86bd6c76eeb62ecfe6a322518ab034ccc9d2' 
  AND (
    token = 'KzUTCYEMc6jelU50tZ/RPckqegUaELOsU7scwYpQF8s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046