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

Query time 0.00057