UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NwGpCalht1oecFubHde5RQWT04nG/FOtj5Z795FG0+w=' 
WHERE 
  key_id = 'b30cd62ac2ab867f49605ed240f808641fbb3caff742e69e34cb8cb19be85b02' 
  AND (
    token = 'NwGpCalht1oecFubHde5RQWT04nG/FOtj5Z795FG0+w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055