UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Zl2sVmS9NiMqjO+SFOJKzU73XJse2oJueXu+Lw5+qrI=' 
WHERE 
  key_id = '00d4eec3994f866a995790936db7e5dc63ed867758a0cd02df25de5370a44f69' 
  AND (
    token = 'Zl2sVmS9NiMqjO+SFOJKzU73XJse2oJueXu+Lw5+qrI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026