UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K2XZDsHPc+GzGoN8+gZ/MoaZmbYXq3Y9FpTshooKh4o=' 
WHERE 
  key_id = '8298fc9cd60b6564e50720d1b4c72f543d2169d9e99a3f62fbe2aee200238fb2' 
  AND (
    token = 'K2XZDsHPc+GzGoN8+gZ/MoaZmbYXq3Y9FpTshooKh4o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034