UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v9RnMqQ7ZJbP0pfc38P/JJGdBKdMqIwm2pSLxJTEiKs=' 
WHERE 
  key_id = '3766d9f60cdba50d4d9f332b0d4d8cdb477783eecb97f8f83b1f79b87617b2c9' 
  AND (
    token = 'v9RnMqQ7ZJbP0pfc38P/JJGdBKdMqIwm2pSLxJTEiKs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039