UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ThMU2iYvVspg+6XKwA6e/gZdCr2nfVIO4Uy8b+xIOZA=' 
WHERE 
  key_id = '08a9155d548f1699d012e8654e182df95fd673e48adcf89b0e80f683d583d3b1' 
  AND (
    token = 'ThMU2iYvVspg+6XKwA6e/gZdCr2nfVIO4Uy8b+xIOZA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019