UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fPniCoBErNcdfNMvBZR+IGMd3sMAFT3mvBOrJ7OgjYs=' 
WHERE 
  key_id = '877bf48c8401a17e9b573ed0c92d2def12b25e66e215c9b349e124858cd987d7' 
  AND (
    token = 'fPniCoBErNcdfNMvBZR+IGMd3sMAFT3mvBOrJ7OgjYs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054