UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bzgy+TCFCvptu3p2F524hIbCycEzARtCZ8E4esQtgrM=' 
WHERE 
  key_id = 'a32a9ee7986084eedfac03718245f21d1e08546ba5b7653bf33e743283561509' 
  AND (
    token = 'Bzgy+TCFCvptu3p2F524hIbCycEzARtCZ8E4esQtgrM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043