UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ig11WXRyHlSxwQmY/orXeU0uWnUcOPfl9p9OazBDSKM=' 
WHERE 
  key_id = 'd2fdbba68527028a80790a3f46d759673cc13cc256561b1ad361c19017524464' 
  AND (
    token = 'Ig11WXRyHlSxwQmY/orXeU0uWnUcOPfl9p9OazBDSKM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042