UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ezZO59e0W22vFSKrEpkDo6sR0Q3biwijyPaqI4ga87U=' 
WHERE 
  key_id = 'f5e375d37560efd5b16b518fce3d6cf60330edde2d5598bc32a96a509ba4da59' 
  AND (
    token = 'ezZO59e0W22vFSKrEpkDo6sR0Q3biwijyPaqI4ga87U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023