UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'alTOhjo5lfCRp2ondoIlIBYcVbEkbYrwn687iBwNweM=' 
WHERE 
  key_id = '6e847f3f4e0f5a2e92ae887b687aefa1878ea62cf8761bfcb5fd947cbe348554' 
  AND (
    token = 'alTOhjo5lfCRp2ondoIlIBYcVbEkbYrwn687iBwNweM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00063