UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c43mfdIXLvL4O2FkVJXLysyKKpnvswucuUlHrqEvY8w=' 
WHERE 
  key_id = '36f008c9d8a3008647a8d148e25a1f14197f75a757efc63056fd3a01d8a9a566' 
  AND (
    token = 'c43mfdIXLvL4O2FkVJXLysyKKpnvswucuUlHrqEvY8w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040