UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BGCE1+oTDuZVC2pRl2/+LBnC5OOlZuVuiB35CkZIsY8=' 
WHERE 
  key_id = '4f017eb56f778a72ce043d685cee9d6c146925af366867de1f31939c7b5ec72d' 
  AND (
    token = 'BGCE1+oTDuZVC2pRl2/+LBnC5OOlZuVuiB35CkZIsY8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028