UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0Zh71bnJ0XVm92mWrREi6jeIwxJEOPX8xJZQ3VLOem4=' 
WHERE 
  key_id = '5652f95659d84cc5dc37422ce9618468caf11b7ada485da19345ce6608834813' 
  AND (
    token = '0Zh71bnJ0XVm92mWrREi6jeIwxJEOPX8xJZQ3VLOem4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034