UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'guTKC/hOuh4K4ADqhuMDZJ1WO11EJnj/zWx2C2RV4rQ=' 
WHERE 
  key_id = 'de260fff6c01ec942705667b120a3046e59d31efe3d393c8ac05da73e56bebc2' 
  AND (
    token = 'guTKC/hOuh4K4ADqhuMDZJ1WO11EJnj/zWx2C2RV4rQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030