UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cKPb33tYzKPbvn6ARa/KmcqKwBhtHQvHHoMF2m2Cbro=' 
WHERE 
  key_id = '6dd7f2039398a06bc91f9a4dbd9e0239d64e85313ee3790268a53effcce2aa6d' 
  AND (
    token = 'cKPb33tYzKPbvn6ARa/KmcqKwBhtHQvHHoMF2m2Cbro=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027