UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RdcA0TA050evOujxIfce1lXeaz8jxumOg6Xgo3H0ZWQ=' 
WHERE 
  key_id = '19eea9a87f322daf3ebdf969775020afceff54113b92275749feac5df7784bd0' 
  AND (
    token = 'RdcA0TA050evOujxIfce1lXeaz8jxumOg6Xgo3H0ZWQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024