UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uS3YvHSOe1oTF1Duv+0KgW5B4M0ZLeymp36G+f7/T2I=' 
WHERE 
  key_id = '6ca2be083347fa2da9337f1f25cd2204991e583021c50bad89240e391e6a3898' 
  AND (
    token = 'uS3YvHSOe1oTF1Duv+0KgW5B4M0ZLeymp36G+f7/T2I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020