UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+Lo6p3D0SehmHXNSXePkUp07SSi5t2WMscJ+9Ycg9zE=' 
WHERE 
  key_id = 'aa339c1e48c2d33ac36efb5c15cf4e56e77b75808420359f4b000c08f9e3b839' 
  AND (
    token = '+Lo6p3D0SehmHXNSXePkUp07SSi5t2WMscJ+9Ycg9zE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030