UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BwbOJpZ+S1llb0thEo0sqd912LpxL7H97KLW3C/+w0g=' 
WHERE 
  key_id = '8aee7741f2cc1dc2a553a7322cb4b506f424a1d34c158648ed22f1d83dea4f9b' 
  AND (
    token = 'BwbOJpZ+S1llb0thEo0sqd912LpxL7H97KLW3C/+w0g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029