UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jV3fCOSNuqRp2oMRk60nQM5PTW7/w9RV+HEMCHAN5TE=' 
WHERE 
  key_id = '582c828c52a153099ad4dbe93df200f7b8bbf23b38239421e5c4d7d72eb6bdef' 
  AND (
    token = 'jV3fCOSNuqRp2oMRk60nQM5PTW7/w9RV+HEMCHAN5TE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039